package ChainOfResponsinility;

import java.util.ArrayList;

public class Chain {
    public Chain setList(DoFormat item) {
        list.add(item);
        hasNext = true;
        return this;
    }

    public DoFormat getList() {
        if(flg + 1 == list.size()){
            hasNext = false;
        }

        return list.get(flg++);
    }

    public void addAll(Chain chainList){
        list.addAll(chainList.getAll());
    }

    public ArrayList<DoFormat> getAll(){
        return list;
    }

    private int flg = 0;

    public boolean isHasNext() {
        return hasNext;
    }

    private boolean hasNext = false;

    private ArrayList<DoFormat> list = new ArrayList<>();

}
